<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue路由开发-路由嵌套</title>
</head>

<body>
    <div id="app">
        <router-view></router-view>
    </div>
    <!-- 一级 -->
    <template id="oneMenu">
        <div>
            <h1>理事会</h1>
            <router-link to="/lsh/msc">秘书处</router-link>
            <router-link to="/lsh/scb">市场部</router-link>
            <router-view></router-view>
        </div>
    </template>

    <!-- 二级-->
    <template id="msc">
        <div>
            <h1>秘书处</h1>
            <router-link to="/lsh/msc/xs">下属部门</router-link>
            <router-view></router-view>
        </div>
    </template>
    <template id="scb">
        <div>
            <h1>市场部</h1>
            <router-link to="/lsh/scb/xs">下属部门</router-link>
            <router-view></router-view>
        </div>
    </template>

    <!-- 三级-->
    <template id="threeMenu">
        <div>
            <ul>
                <li>项目部</li>
                <li>宣传部</li>
                <li>综合部</li>
                <li>财务部</li>
                <li>筹款部</li>
            </ul>
        </div>
    </template>
</body>

</html>
<script type="module">
    import { } from './js/vue.js';
    import { } from './js/vue-router3.js';


    let lsh = { template: "#oneMenu" }
    let msc = { template: "#msc" }
    let scb = { template: "#scb" }
    let xs = { template: "#threeMenu" }
    // 定义路由
    let routes = [
        { path: '/', redirect: '/lsh' },
        {
            path: '/lsh',
            component: lsh,
            children: [
                {
                    path: 'msc',
                    component: msc,
                    children: [{ path: 'xs', component: xs, }],

                },
                {
                    path: 'scb',
                    component: scb,
                },
            ]
        },
    ];
    //路由对象
    const router = new VueRouter({
        routes
    })


    new Vue({
        el: '#app',
        data: {
            msg: 'hello world'
        },
        methods: {
            //自定义方法
        },
        computed: {
            //计算属性
        },
        router,
    })
</script>